<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>InfCommunicationObject</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.0">
<link rel="home" href="index.html" title="libinfinity-0.4 Reference Manual">
<link rel="up" href="ch06.html" title="Network abstraction">
<link rel="prev" href="InfCommunicationManager.html" title="InfCommunicationManager">
<link rel="next" href="InfCommunicationGroup.html" title="InfCommunicationGroup">
<meta name="generator" content="GTK-Doc V1.15 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="InfCommunicationManager.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch06.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libinfinity-0.4 Reference Manual</th>
<td><a accesskey="n" href="InfCommunicationGroup.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#InfCommunicationObject.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#InfCommunicationObject.description" class="shortcut">Description</a>
                   | 
                  <a href="#InfCommunicationObject.object-hierarchy" class="shortcut">Object Hierarchy</a>
                   | 
                  <a href="#InfCommunicationObject.prerequisites" class="shortcut">Prerequisites</a>
                   | 
                  <a href="#InfCommunicationObject.implementations" class="shortcut">Known Implementations</a>
</td></tr>
</table>
<div class="refentry" title="InfCommunicationObject">
<a name="InfCommunicationObject"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="InfCommunicationObject.top_of_page"></a>InfCommunicationObject</span></h2>
<p>InfCommunicationObject — Network message destinations</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1" title="Stability Level">
<a name="InfCommunicationObject.stability-level"></a><h2>Stability Level</h2>
Unstable, unless otherwise indicated
</div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="InfCommunicationObject.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;libinfinity/communication/inf-communication-object.h&gt;

enum                <a class="link" href="InfCommunicationObject.html#InfCommunicationScope" title="enum InfCommunicationScope">InfCommunicationScope</a>;
                    <a class="link" href="InfCommunicationObject.html#InfCommunicationObject-struct" title="InfCommunicationObject">InfCommunicationObject</a>;
                    <a class="link" href="InfCommunicationObject.html#InfCommunicationObjectIface" title="InfCommunicationObjectIface">InfCommunicationObjectIface</a>;
<a class="link" href="InfCommunicationObject.html#InfCommunicationScope" title="enum InfCommunicationScope"><span class="returnvalue">InfCommunicationScope</span></a>  <a class="link" href="InfCommunicationObject.html#inf-communication-object-received" title="inf_communication_object_received ()">inf_communication_object_received</a>
                                                        (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="InfCommunicationObject.html#inf-communication-object-enqueued" title="inf_communication_object_enqueued ()">inf_communication_object_enqueued</a>   (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="InfCommunicationObject.html#inf-communication-object-sent" title="inf_communication_object_sent ()">inf_communication_object_sent</a>       (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>);
</pre>
</div>
<div class="refsect1" title="Object Hierarchy">
<a name="InfCommunicationObject.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="synopsis">
  GInterface
   +----InfCommunicationObject
</pre>
</div>
<div class="refsect1" title="Prerequisites">
<a name="InfCommunicationObject.prerequisites"></a><h2>Prerequisites</h2>
<p>
InfCommunicationObject requires
 <a href="http://library.gnome.org/devel/gobject/unstable/gobject-The-Base-Object-Type.html#GObject">GObject</a>.</p>
</div>
<div class="refsect1" title="Known Implementations">
<a name="InfCommunicationObject.implementations"></a><h2>Known Implementations</h2>
<p>
InfCommunicationObject is implemented by
 <a class="link" href="InfAdoptedSession.html" title="InfAdoptedSession">InfAdoptedSession</a>,  <a class="link" href="InfChatSession.html" title="InfChatSession">InfChatSession</a>,  <a class="link" href="InfSession.html" title="InfSession">InfSession</a>,  <a class="link" href="InfcBrowser.html" title="InfcBrowser">InfcBrowser</a>,  <a class="link" href="InfcSessionProxy.html" title="InfcSessionProxy">InfcSessionProxy</a>,  <a class="link" href="InfdDirectory.html" title="InfdDirectory">InfdDirectory</a> and  <a class="link" href="InfdSessionProxy.html" title="InfdSessionProxy">InfdSessionProxy</a>.</p>
</div>
<div class="refsect1" title="Description">
<a name="InfCommunicationObject.description"></a><h2>Description</h2>
<p>
A <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> is the destination of network messages sent
through the <a class="link" href="InfCommunicationManager.html" title="InfCommunicationManager"><span class="type">InfCommunicationManager</span></a>. Each <a class="link" href="InfCommunicationGroup.html" title="InfCommunicationGroup"><span class="type">InfCommunicationGroup</span></a> is
associated with <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>. Requests received by that group
are reported to the <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> by calling
<a class="link" href="InfCommunicationObject.html#inf-communication-object-received" title="inf_communication_object_received ()"><code class="function">inf_communication_object_received()</code></a> on it. Messages sent to a member of
that group (via <a class="link" href="InfCommunicationGroup.html#inf-communication-group-send-message" title="inf_communication_group_send_message ()"><code class="function">inf_communication_group_send_message()</code></a>) are also reported
by calling <a class="link" href="InfCommunicationObject.html#inf-communication-object-sent" title="inf_communication_object_sent ()"><code class="function">inf_communication_object_sent()</code></a>.
</p>
</div>
<div class="refsect1" title="Details">
<a name="InfCommunicationObject.details"></a><h2>Details</h2>
<div class="refsect2" title="enum InfCommunicationScope">
<a name="InfCommunicationScope"></a><h3>enum InfCommunicationScope</h3>
<pre class="programlisting">typedef enum _InfCommunicationScope {
  INF_COMMUNICATION_SCOPE_PTP,
  INF_COMMUNICATION_SCOPE_GROUP
} InfCommunicationScope;
</pre>
<p>
<a class="link" href="InfCommunicationObject.html#InfCommunicationScope" title="enum InfCommunicationScope"><span class="type">InfCommunicationScope</span></a> specifies to which hosts a message belongs.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="INF-COMMUNICATION-SCOPE-PTP:CAPS"></a><span class="term"><code class="literal">INF_COMMUNICATION_SCOPE_PTP</code></span></p></td>
<td>The message is sent from one group member to
another.
</td>
</tr>
<tr>
<td><p><a name="INF-COMMUNICATION-SCOPE-GROUP:CAPS"></a><span class="term"><code class="literal">INF_COMMUNICATION_SCOPE_GROUP</code></span></p></td>
<td>The message is sent to all group members.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="InfCommunicationObject">
<a name="InfCommunicationObject-struct"></a><h3>InfCommunicationObject</h3>
<pre class="programlisting">typedef struct _InfCommunicationObject InfCommunicationObject;</pre>
<p>
<a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> is an opaque data type. You should only access it
via the public API functions.
</p>
</div>
<hr>
<div class="refsect2" title="InfCommunicationObjectIface">
<a name="InfCommunicationObjectIface"></a><h3>InfCommunicationObjectIface</h3>
<pre class="programlisting">typedef struct {
  InfCommunicationScope (*received)(InfCommunicationObject* object,
                                    InfXmlConnection* conn,
                                    xmlNodePtr node,
                                    GError** error);

  void (*enqueued)(InfCommunicationObject* object,
                   InfXmlConnection* conn,
                   xmlNodePtr node);

  void (*sent)(InfCommunicationObject* object,
               InfXmlConnection* conn,
               xmlNodePtr node);
} InfCommunicationObjectIface;
</pre>
<p>
The virtual methods of <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>. These are called by the
<span class="type">InfConnectionManager</span> when appropriate.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="InfCommunicationObjectIface.received"></a>received</code></em> ()</span></p></td>
<td>Called when a message for the group related to this
<a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> was received.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="InfCommunicationObjectIface.enqueued"></a>enqueued</code></em> ()</span></p></td>
<td>Called when a message to be sent to another group member has
been enqueued, which means sending it can no longer be cancelled via
<code class="function">inf_connection_manager_group_clear_queue()</code>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="structfield"><code><a name="InfCommunicationObjectIface.sent"></a>sent</code></em> ()</span></p></td>
<td>Called when a message has been sent to another group member of the
group related no this <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="inf_communication_object_received ()">
<a name="inf-communication-object-received"></a><h3>inf_communication_object_received ()</h3>
<pre class="programlisting"><a class="link" href="InfCommunicationObject.html#InfCommunicationScope" title="enum InfCommunicationScope"><span class="returnvalue">InfCommunicationScope</span></a>  inf_communication_object_received
                                                        (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>,
                                                         <em class="parameter"><code><a href="http://library.gnome.org/devel/glib/unstable/glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>
This function is called when a <a class="link" href="InfCommunicationManager.html" title="InfCommunicationManager"><span class="type">InfCommunicationManager</span></a> received data from
<em class="parameter"><code>connection</code></em> belonging to a group whose communication object is <em class="parameter"><code>object</code></em>.
This function should process the incoming data. If it could not process it,
then it should set <em class="parameter"><code>error</code></em>.
</p>
<p>
It should return <a class="link" href="InfCommunicationObject.html#INF-COMMUNICATION-SCOPE-GROUP:CAPS"><code class="literal">INF_COMMUNICATION_SCOPE_GROUP</code></a> if the message is allowed
to be forwarded to other group members. Since recipients of forwarded
messages don't see the original sender (but just the forwarding host),
forwarding arbitrary messages could lead to a security problem in the worst
case.
</p>
<p>
For example, if, in central mode, a client sends an (invalid)
&lt;add-node&gt; request to the whole (InfDirectory) group, and the server
forwarded this to all clients, those clients would try to create a new node
although the server rejected the request. In decentral mode, this is not a
problem since all clients see where the message comes from, and can
themselves reject all messages not coming from the server.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
<td>A <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>The <a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> data was received from.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
<td>The received data.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>error</code></em> :</span></p></td>
<td>Location to store error information, if any.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> <a class="link" href="InfCommunicationObject.html#INF-COMMUNICATION-SCOPE-GROUP:CAPS"><code class="literal">INF_COMMUNICATION_SCOPE_GROUP</code></a> if the message is allowed to
be forwarded, <a class="link" href="InfCommunicationObject.html#INF-COMMUNICATION-SCOPE-PTP:CAPS"><code class="literal">INF_COMMUNICATION_SCOPE_PTP</code></a> if not.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="inf_communication_object_enqueued ()">
<a name="inf-communication-object-enqueued"></a><h3>inf_communication_object_enqueued ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                inf_communication_object_enqueued   (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>);</pre>
<p>
This function is called, when an XML message scheduled to be sent via
<a class="link" href="InfCommunicationGroup.html#inf-communication-group-send-message" title="inf_communication_group_send_message ()"><code class="function">inf_communication_group_send_message()</code></a> or
<a class="link" href="InfCommunicationGroup.html#inf-communication-group-send-group-message" title="inf_communication_group_send_group_message ()"><code class="function">inf_communication_group_send_group_message()</code></a> cannot be cancelled anymore,
because it was already passed to <em class="parameter"><code>conn</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
<td>A <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>A <a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
<td>The XML data.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="inf_communication_object_sent ()">
<a name="inf-communication-object-sent"></a><h3>inf_communication_object_sent ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                inf_communication_object_sent       (<em class="parameter"><code><a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a> *object</code></em>,
                                                         <em class="parameter"><code><a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a> *conn</code></em>,
                                                         <em class="parameter"><code><span class="type">xmlNodePtr</span> node</code></em>);</pre>
<p>
This function is called when a XML message sent via
<a class="link" href="InfCommunicationGroup.html#inf-communication-group-send-message" title="inf_communication_group_send_message ()"><code class="function">inf_communication_group_send_message()</code></a> or
<a class="link" href="InfCommunicationGroup.html#inf-communication-group-send-group-message" title="inf_communication_group_send_group_message ()"><code class="function">inf_communication_group_send_group_message()</code></a> has actually been sent out.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>object</code></em> :</span></p></td>
<td>A <a class="link" href="InfCommunicationObject.html" title="InfCommunicationObject"><span class="type">InfCommunicationObject</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>conn</code></em> :</span></p></td>
<td>A <a class="link" href="InfXmlConnection.html" title="InfXmlConnection"><span class="type">InfXmlConnection</span></a>.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>node</code></em> :</span></p></td>
<td>The sent data.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
<div class="refsect1" title="See Also">
<a name="InfCommunicationObject.see-also"></a><h2>See Also</h2>
<a class="link" href="InfCommunicationManager.html" title="InfCommunicationManager"><span class="type">InfCommunicationManager</span></a>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.15</div>
</body>
</html>